package com.echo.model.resq.response.result;

import com.echo.model.resq.response.CommonCode;
import com.echo.model.resq.response.base.Response;
import com.echo.model.resq.response.base.ResultCode;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @version: V1.0
 * @author: chentailai
 * @description: 响应结果对象
 * @className: ResponseResult
 * @packageName: com.echo.model.resq.response
 * @data: 2020/3/26 17:17
 **/
@Data
@ToString
@NoArgsConstructor
public class ResponseResult implements Response {

    //操作是否成功
    boolean success = SUCCESS;

    //操作代码
    int code = SUCCESS_CODE;

    //提示信息
    String message;

    public ResponseResult(ResultCode resultCode){
        this.success = resultCode.success();
        this.code = resultCode.code();
        this.message = resultCode.message();
    }

    public static ResponseResult SUCCESS(){
        return new ResponseResult(CommonCode.SUCCESS);
    }
    public static ResponseResult FAIL(){
        return new ResponseResult(CommonCode.FAIL);
    }

}
